﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using MyOA.Model;

namespace MyOA.DAL
{
    public class LeftPanelService
    {
        DBHelper db = new DBHelper();

      
        /// <summary>
        /// 根据登陆号获取权限信息集合
        /// </summary>
        /// <param name="loginId">登陆号</param>
        /// <returns>返回权限信息</returns>      
        public IList<SysFun> getSysFunByLoginId(string loginId)
        {
            IList<SysFun> sysFuns = new List<SysFun>();
            using (SqlDataReader reader = db.getDataReader("sp_getSysFunByLoginId",new SqlParameter("@loginId",loginId)))
            {
                while (reader.Read())
                {
                    SysFun sysFun = new SysFun();

                    sysFun.NodeId = (int)reader[0];
                    sysFun.DisplayName = (string)reader[1];
                    sysFun.NodeURL = (string)reader[2];
                    sysFun.DisplayOrder = (int)reader[3];
                    sysFun.ParentNodeId = (int)reader[4];

                    sysFuns.Add(sysFun);
                }
            }
            db.CloseConnection();
            return sysFuns;
        }
    }
}
